<div id="sessionInfoBox">
    <div id="sessionInfo" class="session-name" style="display: flex; align-items: center; gap: 10px;">
        <span id="sessionInsId">{{ session_ins_id }}</span> 
        <span id="sessionInsName">{{ session_ins_name }}</span>
        <span id="sessionInsRole">{{ session_role }}</span>
        <span id="sessionLoggedIn" style="display: none;">{{ session_logged_in }}</span>
        <span id="showRole"></span>
        <button id="logout" onclick="logout()" class="session-name" style="margin: 0; padding: 2px 5px; font-size: 8px; height: 20px; width:60px;line-height: 1;">退出登录</button>
        <button id="goIndex" onclick="goIndex()" class="session-name" style="margin: 0; padding: 2px 5px; font-size: 8px; height: 20px; width:60px;line-height: 1;">返回首页</button>
        <span id="dataBaseType" style="margin-left:10px;"></span>
    </div>
</div>

<script>
    //获取数据库类型并显示在状态栏上
    (function (){
    const dataBaseType=document.getElementById('dataBaseType');
    dataBaseType.innerHTML='';
    fetch('/check_database_type')
    .then(response=>response.json())
    .then(data=>{
        // console.log('databae type:',data);
        if(data['data_base_type']==='测试机'){
            dataBaseType.innerHTML=`<span style="color:red;">${data['data_base_type']} ${data['data_base_name']}</span>`;
        }else{
            dataBaseType.innerHTML=''
        }
    })
})();


</script>